package com.zhuojy.equity.mall.admin.manager;

import java.util.List;

import cn.hutool.core.collection.CollUtil;
import com.zhuojy.equity.mall.admin.common.exception.Asserts;
import com.zhuojy.equity.mall.admin.dal.mapper.TUserRoleRelationMapper;
import lombok.RequiredArgsConstructor;

import org.springframework.stereotype.Component;

/**
 * 角色与角色关系表数据管理层
 */
@Component
@RequiredArgsConstructor
public class UserRoleRelationManager {

	private final TUserRoleRelationMapper userRoleRelationMapper;

	public List<Long> queryRoleIdListByUserId(Long userId) {
		List<Long> roleIdList = userRoleRelationMapper.selectRoleIdListByUserId(userId);
		if (CollUtil.isEmpty(roleIdList)) {
			Asserts.fail("用户尚未分配角色！");
		}
		return roleIdList;
	}
}
